package net.passClass;

import com.alibaba.fastjson.JSON;
import model.hospital.Building;
import model.hospital.Room;

import java.util.ArrayList;
import java.util.Collection;

public class PassRoom extends PassData{
    public PassRoom(boolean flag, ArrayList<Room> staffs , String message) {
        super(flag, message);
        this.setData(staffs);
    }

    public PassRoom() {
    }

    public ArrayList<Room> getData(int i) {
        return (ArrayList<Room>)super.getData();
    }
    public ArrayList<Room> getData() {
        ArrayList<Room> rooms = new ArrayList<Room>();
        ArrayList<Room> data = new ArrayList<Room>();
        data.addAll((Collection<? extends Room>) super.getData());

        for(int i = 0; i<data.size(); i++){
            Room aRoom = JSON.parseObject(JSON.toJSONString(data.get(i)),Room.class);
            rooms.add(aRoom);
        }

        return rooms;
    }
}
